<template>

  <div style="background: #F7F7F7">
	<!-- <mt-cell title="查看新版本" is-link style="margin-top: 0.3rem;">
		<span>当前版本：1.0.0</span>
	</mt-cell>
	
    <mt-cell title="关于我们" is-link @click.native="us()" style="margin-top: 0.3rem;">
    </mt-cell> -->
	<div class="titletop">
		
		<div class="celltitle">
			<div class="cell-left">版本号</div>
			<div class="cell-right"><span>{{vernew}}</span></div>
		</div>
		
		<div class="celltitle" @click="us()">
			<div class="cell-left">关于我们</div>
			<div class="cell-right"><img src="../../../src/assets/img/my-left.png"></img></div>
		</div>
		
		<div class="celltitle" @click="ofterquestion()">
			<div class="cell-left">帮助中心</div>
			<div class="cell-right"><img src="../../../src/assets/img/my-left.png"></img></div>
		</div>
		
	</div>


    <van-button v-if='token!=""' type="info" class="tuichu" @click="btn()">退出登录</van-button>

  </div>



</template>

<script>
    export default {
        name: "Shezhi",
      data(){
          return{
            token:'',
			vernew:this.$store.state.vernew,
          }
      },
      methods:{
		  ofterquestion(){
			  this.$router.push({
			   path:'/ofterquestion'
			 }) 
		  },
          us(){
            this.$router.push({
              path:'/about'
            })
          },
        btn(){
			this.axios.post(this.$store.state.url + "User/logout").then(res=>{
				
				if (res.data.errcode == 0||res.data.errcode == '0'){
					this.$toast({
						message:'账号已退出',
						position:'bottom'
					});
					var that = this;
					localStorage.clear();
					sessionStorage.clear();
					this.axios.defaults.headers.common['token'] = '';
					setTimeout(function(){
						that.$router.push({
							path:'/user'
						})
					},1500)
				}else{
					this.$toast({
						message:res.data.msg,
						position:'bottom'
					});
				}
			})
        },
		//删除cookie中所有定变量函数    
//         delAllCookie(){  
// 			console.log(888);
//             var myDate=new Date();    
//             myDate.setTime(-1000);//设置时间    
//             var data=document.cookie;    
//             var dataArray=data.split("; ");    
//             for(var i=0;i<dataArray.length;i++){    
//                  var varName=dataArray[i].split("=");    
//                  document.cookie=varName[0]+"=''; expires="+myDate.toGMTString();    
//             }    
//                           
//         }  
      },
		mounted(){
			this.sdk.getJSSDK('','',this.$store.state.url);	
			// this.delAllCookie();
			if(localStorage.getItem('token')){
				this.token = localStorage.getItem('token')
			}
		}
    }
</script>

<style scoped>
	.titletop{
		margin-top: .3rem;
	}
	.celltitle{
		width: 100%;
		background: #fff;
		display: flex;
		justify-content: space-between;
		height: .9rem;
		line-height: .9rem;
		color: #333333;
	}
	.celltitle{
		border-bottom:1px solid #ededed;
	}
	/* .celltitle:last-child{
		border-bottom:none;
	} */
	.cell-left{
		font-size: .3rem;
		padding-left:.3rem;
	}
	.cell-right{
		padding-right: .3rem;
	}
	.cell-right span{
		display: inline-block;
		color: #999999 !important;
		font-size: .26rem;
		margin-right: .3rem;
	}
	.cell-right img{
		display: inline-block;
		width: .1rem;
		height: .2rem;
		vertical-align: middle;
	}
  .tuichu{
    width: 100%;
    height: 0.88rem;
    position: fixed;
    bottom: 0;
    background:rgba(2,135,255,1);
    font-size:0.36rem;
    font-weight:bold;
    color:rgba(255,255,255,1);
  }
</style>
